home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: PUBLIC / PRIVATE
- Date: 21 Apr 1996 16:32:54 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4ldnvm$bui@sparcserver.lrz-muenchen.de>
- References: <317941B9.39B7@umdnj.edu>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- "G Ralph Kuntz, MD" <kuntz@umdnj.edu> writes:
-
- >> Perhaps in a header file or somewhere you'll find something like
- >>
- >> #define PUBLIC
- >> #define PRIVATE static
-
- >A couple of books I have on the C programming style suggests staying
- >away from this sort of thing for excatly this reason. In particular,
- >they suggest NOT defining FALSE = 0 and TRUE = 1 but just using the
- >constants 0 and 1 directly and testing variables as in "if (a_boolean)
- >..." rather than "if (a_boolean == TRUE) ..."
-
- Whether it is good practice to define or not define TRUE and FALSE,
- as long as TRUE is defined as a non-zero value and false is defined as
- zero is open to debate. The main problem with this is that everybody
- does it, but does it slightly different from all others in most
- cases so that you end up with half a dozend different TRUE definitions
- in a project that includes 5 third party header files.
-
- "if (a_boolean == TRUE)", otoh, is a _very_ strange piece of code.
- Why would you stop with _one_ level of truth? This should at least
- be "if (((a_boolean == TRUE) == TRUE) == TRUE)" for extra clarity.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
-